package com.mmall.controller;

import com.mmall.beans.PageQuery;
import com.mmall.common.JsonData;
import com.mmall.param.SearchLogParam;
import com.mmall.service.SysLogService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * @Auther 19135
 * @Date 2019/3/31 20:18
 * @Description ${end}$
 */
@Controller
@RequestMapping("/sys/log")
public class SysLogController {

	@Resource
	private SysLogService sysLogService;

	@RequestMapping("/log.page")
	public ModelAndView page() {
		return new ModelAndView("log");
	}

	@RequestMapping("/recover.json")
	@ResponseBody
	public JsonData recover(@RequestParam("id") int id) {
		sysLogService.recover(id);
		return JsonData.success();
	}

	@RequestMapping("/page.json")
	@ResponseBody
	public JsonData searchPage(SearchLogParam param, PageQuery page) {
		return JsonData.success(sysLogService.searchPageList(param, page));
	}
}
